<template>
	<view id="news">
		<view class="padding-tb margin-lr solid-bottom">
			<view class="text-xl padding-bottom-sm">{{newsDetailsList.title}}</view>
			<view class="text-sm" style="color:#999;">
				<text class="padding-right-lg">时间：{{newsDetailsList.created_at}}</text>
				<text>阅读：{{newsDetailsList.watch_count}}</text>
			</view>
		</view>
		
		<!-- <view class="padding" style="line-height: 1.8" v-html="newsDetailsList.content"></view> -->
		
		<view class="padding" style="line-height: 1.8">
			<u-parse :content="newsDetailsList.content"/>
		</view>
	</view>
</template>
 
<script>
	import uParse from '@/components/gaoyia-parse/parse.vue'
	import {mapState} from 'vuex'
	
	export default {
		components: {
		uParse
	  },
		data() {
			return {
			};
		},
		onLoad(obj) {
			uni.showNavigationBarLoading()
			
			// 新闻详情
			this.getNewsDetails(obj.newsId)
		},
		methods: {
			// 新闻详情
			async getNewsDetails(id){
				let res = await this.$api.newsDetails(id)
				if(res.statusCode === 200){
					uni.hideNavigationBarLoading()
					
					console.log('新闻详情', res.data.data)
					
					this.$store.dispatch('sendNewsDetails', res.data.data)
				}
			}
		},
		computed: {
			...mapState(['newsDetailsList'])
		}
	}
</script>

<style lang="scss">
	page{
		background-color: $uni-bg-color;
	}
</style>
